<template>
	<view class="main">

		<view class="form">

			<!-- 		<view class="nav">
				<navigator url="../forget/forget">找回密码</navigator>
			</view> -->
			<view class="title">
				<image src="../../../static/images/logo.png" mode=""></image>
			</view>
			<view class="list">
				<image src="../../../static/images/phone.png" mode="aspectFit"></image><input type="text"
					v-model="phone" placeholder="请输入您的账号">
			</view>
			<view class="list">
				<image src="../../../static/images/pwd.png" mode="aspectFit"></image></i><input type="password"
					v-model="pwd" placeholder="请输入密码">
			</view>
			<view class="btn" @click="handlogin">
				登录
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				phone: '',
				pwd: '',

			};
		},
		methods: {
			handlogin() {
				if (this.phone == '' || this.pwd == '') {
					uni.showToast({
						title: '账号密码不能为空',
						icon: "none",
						mask: true,
						duration: 1000
					})
				} else {
					global.$http.request({
						url: '/api/Login/login',
						data: {
							phone: this.phone,
							pwd: this.pwd,
						}
					}).then(res => {
						console.log(res);
						// console.log(res.data.data.msg);
						if (res.data.code == 200) {
							uni.setStorageSync('token', res.data.data.token);
							uni.setStorageSync('userinfo', res.data.data);
							uni.showToast({
								title: res.data.msg,
								icon: "none",
								mask: true,
								duration: 1000
							})
							setTimeout(function() {
								uni.switchTab({
									url: '../../pending/pending'
								})
							}, 1000)
						}
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		font-family: PingFang SC;
		background: #FFFFFF;

		.main {
			width: 750rpx;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-between;

			.form {
				width: 750rpx;
				height: 750rpx;
				// margin-top: 40%;
				display: flex;
				flex-direction: column;
				align-items: center;


				.list {
					width: 550rpx;
					// height: 110rpx;
					display: flex;
					align-items: center;
					padding: 64rpx 20rpx 31rpx 0;
					border-bottom: 2rpx solid #808080;
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 40px;

					image {
						margin: 0 29rpx 0 13rpx;
						width: 25rpx;
						height: 36rpx;
					}

					input {
						width: 100%;
					}
				}

				.title {
					margin: 246rpx 0 117rpx 0;

					image {
						width: 342rpx;
						height: 162rpx;
						;
					}
				}

				.nav {
					width: 400rpx;
					margin-top: 20rpx;
					display: flex;
					flex-direction: row-reverse;
					font-size: 26rpx;
					color: #808080;
				}

				.btn {
					width: 630rpx;
					padding: 34rpx 0;
					background: #DF3D3D;
					border-radius: 49rpx;
					font-size: 32rpx;
					color: #fff;
					display: flex;
					align-items: center;
					justify-content: center;
					margin-top: 228rpx;
				}
			}
		}

	}
</style>
